#import "JVPharosBlankScreeModel.h"
#import "ALUtils.h"
@implementation JVPharosBlankScreeModel

/**
 {
 "v": 1, // 接口版本，现在为1
 "ut": 1484536179728, // 批量上传的时间戳，毫秒
 "app": "lufax", // 应用名称(长度不超过20个字符)
 "av": "3.3.7", // APP 版本（非中文）
 "cid": "client id" // client id
 "p": "ios", // 平台，比如 android，ios 等，英文
 "pv": "ios10.1", // 平台版本，比如 ios10.1 等，英文
 "d": "apple", // 设备名称，比如 apple，英文
 "dv": "iphone7s" // 具体的手机型号，比如 iphone7s，英文
 "l": [{
 "type": "bs",
 "t": 1484536179728, // 请求发起的时间，时间戳，毫秒
 "page": "page", // URL，非动态保证（长度不超过255个字符）
 "np": "network protocols(2G, 3G, 4G, wifi)", // 网络协议，英文
 "bs": 0, // 白屏结果
 "src": "back" // back or normal
 "c": "native", //native or h5
 "d": "data"
 }]
 }
 */
+ (JVPharosBlankScreeModel *)generatePharosItemModel:(NSDictionary *)blankScreenDic {
//    NSDate *currentDate = [[LFSynchronizer instance] checkedTime];
    //TODO: 需要同步服务器时间
    NSDate *currentDate = [NSDate date];
    JVPharosBlankScreeModel *pharosItemModel = [JVPharosBlankScreeModel new];
    pharosItemModel.type = @"bs";
    pharosItemModel.t = [ALDateUtils iso8601DateString];
    pharosItemModel.page = [blankScreenDic objectForKey:@"url"];
    pharosItemModel.np = @"";
    pharosItemModel.bs = [[blankScreenDic objectForKey:@"ret"] integerValue];
    pharosItemModel.bst = [[blankScreenDic objectForKey:@"delay_time"] integerValue];
    pharosItemModel.src = [blankScreenDic objectForKey:@"fromWhere"];
    pharosItemModel.c = @"native";
    pharosItemModel.d = [blankScreenDic objectForKey:@"query_str"];
    return pharosItemModel;
}

- (NSDictionary *)pharosModeToDic{
    NSDictionary *pharosModel_dic = [NSDictionary new];
    pharosModel_dic = @{@"type":self.type?:@"",
                        @"t":self.t?:@"",
                        @"page":self.page?:@"",
                        @"np":self.np?:@"",
                        @"bs":@(self.bs)?:@"",
                        @"bst":@(self.bst)?:@"",
                        @"src":self.src?:@"",
                        @"c":self.c?:@"",
                        @"d":self.d?:@"",
                        @"p":self.p?:@{},
                        @"z0":self.z0?:@(0),
                        };
    return pharosModel_dic;
}

- (NSString *)commandId{
    return self.page;
}

@end
